package cn.agiledata.bank.linkbank.impl.cib;

import cn.agiledata.bank.common.util.StringUtil;
import cn.agiledata.bank.linkbank.logic.CryptoKeyValidator;

/**
 * 中国兴业银行mac密钥校验器
 * 
 * @author 马贤波
 * 
 */
public final class CibCryptoKeyValidator implements CryptoKeyValidator {

    public String getCryptoKeyDescription() {
        return "constant.bank.net.mac_key_rule.cib";
    }

    public boolean validateCryptoKey(String cryptoKey) {
        if (cryptoKey == null)
            return false;
        String pattern = "[0-9a-zA-Z]{8}";
        return StringUtil.matchRegex(cryptoKey, pattern);
    }

}
